<%@ Control Language="C#" AutoEventWireup="true" Inherits="System.Web.Mvc.ViewUserControl<ETestIT.Web.Controllers.UsersController.UserFormViewModel>" %>
<%@ Import Namespace="ETestIT.Core" %>
<%@ Import Namespace="ETestIT.Web.Controllers" %>
<% if (ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] != null)
   { %>
<p id="pageMessage">
    <%= ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()]%></p>
<% } %>
<%= Html.ValidationSummary() %>
<% using (Html.BeginForm())
   { %>
    <%= Html.AntiForgeryToken() %>
    <%= Html.Hidden("User.Id", (ViewData.Model.User != null) ? ViewData.Model.User.Id : 0)%>
        <label for="User_Name">
            Name:</label>
        <%= Html.TextBox("User.Name", (ViewData.Model.User != null) ? ViewData.Model.User.Name.ToString() : "")%>

        <label for="User_Password">
            Password:</label>
        <%= Html.TextBox("User.Password", (ViewData.Model.User != null) ? ViewData.Model.User.Password.ToString() : "")%>

    <%= Html.SubmitButton("btnSave", "Save") %>
    <%= Html.Button("btnCancel", "Cancel", HtmlButtonType.Button, 
				    "window.location.href = '" + Html.BuildUrlFromExpression<UsersController>(c => c.Index(null)) + "';") %>
<% } %>
